package com.neusoft.mapping;

import com.neusoft.db.DBManager;

import java.util.HashMap;
import java.util.Map;

public class MappingFactory {
    private Map<String,EntityMapping> maps = new HashMap();
    private static MappingFactory mappingFactory = null;
    public static final String USER_MAPPING = "userMapping";
    //public static final String XXX_MAPPING = "xxxMapping";
    private MappingFactory(){
    }

    public static MappingFactory getInstance() {
        if (mappingFactory == null) {
            mappingFactory = new MappingFactory();
            //向Map集合中添加元素
            mappingFactory.maps.put(USER_MAPPING, new UserMapping());
            //mappingFactory.maps.put(XXX_MAPPING, new XXXMapping());
        }
        return mappingFactory;
    }

    //从Map容器中获取对象
    public EntityMapping getMapping(String key) {
        return maps.get(key);
    }

}
